function [violations_percentage] = HPZ_Budget_Lines_Test (data,treatment,flag,param)

[~,~,~,~,~,~,~,~,~,FLAGS,~,~,~,~,~] = HPZ_Subject_Consistency (data);

if FLAGS(3)==1
    
   violations_percentage=1;
   
else
    
    max_vectors = HPZ_Generate_Random_Budget_Lines ();

    prices = 1./max_vectors;

    % The endowments are normalized to 1
    endowments=ones(length(max_vectors),1);

    [choice_matrix] = HPZ_Choices (prices,endowments,treatment,flag,1,param);

    choices=[choice_matrix prices];

    violations=0;

    for i=1:length(max_vectors)
   
        input = [data ; choices(i,:)];
    
        [~,~,~,~,~,~,~,~,~,FLAGS,~,~,~,~,~] = HPZ_Subject_Consistency (input);

        violations=violations+FLAGS(3);
    
    end

    violations_percentage=violations/(length(max_vectors));
    
end



end